import { stringify } from 'qs';
import request from '@/utils/request';

const api = '/api/box';

export async function getByBillId(id) {
  const urlString = `${api}/GetByBillId?billId=${id}`;
  return request(urlString);
}

export async function getByHBLId(id) {
  const urlString = `${api}/GetByHBLId?billId=${id}`;
  return request(urlString);
}

export async function getBoxCountView(params) {
  const urlString = `${api}/GetBoxCountView?${stringify(params)}`;
  return request(urlString);
}

export async function remove(id) {
  return request(`${api}/${id}`, {
    method: 'DELETE',
  });
}

export async function update(params) {
  return request(`${api}/${params.id}`, {
    method: 'PUT',
    body: params,
  });
}
